package com.knight.condition;

import java.lang.reflect.WildcardType;
import java.util.concurrent.ArrayBlockingQueue;

public class SimpleQueueTest {

    public static void main(String[] args) throws InterruptedException {
        SimpleQueue simpleQueue = new SimpleQueue(2);

        new Thread(() -> {
            while (true) {
                simpleQueue.put(new Data());
            }
        }).start();


        new Thread(() -> {
            while (true) {
                System.out.println(simpleQueue.take());
            }
        }).start();
        Thread.sleep(100000);

/*        ArrayBlockingQueue<Data> blockingQueue = new ArrayBlockingQueue(3);


        new Thread(()-> {
            try {
                while (true) {
                    blockingQueue.put(new Data());
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();




        new Thread(()-> {
            try {
                while (true) {
                    System.out.println(blockingQueue.take());
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(()-> {
            try {
                while (true) {
                    System.out.println(blockingQueue.take());
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(()-> {
            try {
                while (true) {
                    System.out.println(blockingQueue.take());
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();



        Thread.sleep(100000);*/

    }
}
